<%-- 
    Document   : HeaderApple
    Created on : Oct 6, 2011, 11:34:05 PM
    Author     : kijoo
--%>


<%@page import="MODEL.POJO.SanPhamPOJO"%>
<%@page import="MODEL.DAO.SanPhamDAO"%>
<%@page import="MODEL.DAO.DanhMucDAO"%>
<%@page import="MODEL.POJO.DanhMucPOJO"%>
<%@page import="MODEL.POJO.LoaiDanhMucPOJO"%>
<%@page import="java.util.ArrayList"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<div><img src="images/banner-top.jpg"/></div>
<div class="bg">
    <div class="logo"><img src="images/logo.jpg" /></div>
    <div class="user"><a href="#">Tài khoản</a> | <a href="#">Giỏ hàng </a>| <a href="#">Login</a> | <a href="#">Logout</a></div>
    <form id="form1" name="form1" method="get" action="SearchController">  
        <div class="b"></div>
        <div class="timkiem"><input type="text" name="tbtensanpham" width="100px"/>
            <input type="submit" name="bttimkiem" id="bttimkiem" value="Tìm Kiếm" />
            <input type="hidden" name="Action" value="Search" />
            <input type="hidden" name="idloaisanpham" value="<%=(String) request.getAttribute("LoaiSanPhams")%>"/>
        </div>
        <div class="e">

        </div>
    </form>
    <div class="space"></div>
</div> 
<div class="menu">
    <div class="menudrop">
        <!--Menu loai danh muc CHA--> 
        <ul>
            <li><a href="HomeController?Action=View" id="current"/>Trang Chủ</li>
            <%
                String loaisanpham=(String)request.getAttribute("LoaiSanPhams");
                ArrayList<LoaiDanhMucPOJO> ds = (ArrayList<LoaiDanhMucPOJO>) request.getAttribute("LoaiDanhMucs");
                for (int i = 0; i < ds.size(); i++) {
                    LoaiDanhMucPOJO ldm = ds.get(i);

            %>
            <li><a href="DanhSachSanPhamController?Action=<%=loaisanpham %>&idloaidanhmuc=<%=ldm.getIdloaidanhmuc()%>&Trang=1" id="current"/><%=ldm.getTenloaidanhmuc()%></a>
                <!--Menu danh muc con--> 
                <ul><%
                    ArrayList<DanhMucPOJO> danhmuc = DanhMucDAO.LayDanhSachDanhMuc(ldm.getIdloaidanhmuc());
                    for (int j = 0; j < danhmuc.size(); j++) {
                        DanhMucPOJO dm = danhmuc.get(j);%>
                    <li><a href="DanhSachSanPhamController?Action=<%=loaisanpham %>&iddanhmuc=<%=dm.getIddanhmuc()%>&Trang=1" id="current"/><%=dm.getTendanhmuc()%></a>
                        <!--Menu dong san pham--> 
                        <ul><%
                            ArrayList<SanPhamPOJO> dssp = SanPhamDAO.LayDanhSachSanPham(dm.getIddanhmuc());
                            for (int k = 0; k < dssp.size(); k++) {
                            SanPhamPOJO sp = dssp.get(k);
                            if(sp.getDongsanpham() == null || sp.getDongsanpham() == ""){break;}
                            else{
                            %>
                            <li ><a href="DanhSachSanPhamController?Action=<%=loaisanpham %>&idsanpham=<%=sp.getIdsanpham()%>&Trang=1"/><%=sp.getDongsanpham()%></a></li>
                            <%
                            }}%>
                        </ul>
                    </li>
                    <%}%>
                </ul>
            </li>
            <%}%>
            <% if(loaisanpham.equals("LAPTOP")){
            %>
            <li><a href="HomeController?Action=APPLE&idloaisanpham=APPLE" id="current" />Apple</li>
            <li><a href="HomeController?Action=PC&idloaisanpham=PC" id="current" />Desktop</li>
            <%}%>
            <li><a href="#" id="current" />Download báo giá</li>
        </ul>
    </div>
</div>
<div class="menu"><img src="images/slide.jpg" width="940" height="365" /></div>
